using System;
using System.Windows.Automation;
using ProdLogging;

namespace ProdControls
{
    /// <summary>
    ///   This handles items with ControlType.Text (labels)
    /// </summary>
    public sealed class ProdText : BaseProdControl
    {
        #region Constructors

        /// <summary>
        ///   Initializes a new instance of the ProdButton class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="automationId"> The UI Automation element </param>
        /// <remarks>
        ///   Will attempt to match AutomationId, then ReadOnly
        /// </remarks>
        public ProdText(ProdWindow prodWindow, string automationId)
            : base(prodWindow, automationId)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdButton class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="treePosition"> The index of this control in the parent windows UI control tree. </param>
        public ProdText(ProdWindow prodWindow, int treePosition)
            : base(prodWindow, treePosition)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdButton class.
        /// </summary>
        /// <param name="controlHandle"> Window handle of the control </param>
        public ProdText(IntPtr controlHandle)
            : base(controlHandle)
        {
        }

        #endregion

        public bool ReadOnly
        {
            get
            {
                TextPattern tp = (TextPattern) UiaElement.GetCurrentPattern(TextPattern.Pattern);
                return (bool) tp.DocumentRange.GetAttributeValue(TextPattern.IsReadOnlyAttribute);
            }
        }

        /// <summary>
        ///   Set label text to an empty string
        /// </summary>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public void Clear()
        {
            throw new NotImplementedException();
        }


        /// <summary>
        ///   Gets the number of characters in Text Control
        /// </summary>
        /// <returns> The number of characters in the Text Control </returns>
        /// <remarks>
        ///   Will attempt to match AutomationId, then ReadOnly
        /// </remarks>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetTextLength()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        ///   Gets or sets the text contained in the current Text Control
        /// </summary>
        /// <returns> The text currently in the Text Control </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public string GetText()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        ///   Gets or sets the text contained in the current Text Control
        /// </summary>
        /// <param name="text"> The text to place into the Text Control. </param>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public void SetText(string text)
        {
            throw new NotImplementedException();
        }
    }
}